home *** CD-ROM | disk | FTP | other *** search
/ HPAVC / HPAVC CD-ROM.iso / pc / SNNSV32.ZIP / SNNSv3.2 / xgui / sources / o_graph.c < prev    next >
Encoding:
C/C++ Source or Header  |  1994-04-25  |  33.5 KB  |  1,024 lines

  1. /*****************************************************************************
  2.   FILE           : o_graph.c
  3.   SHORTNAME      : o_graph.c
  4.   SNNS VERSION   : 3.2
  5.  
  6.   PURPOSE        : Contains all functions to run GRAPH.
  7.   NOTES          : You may wonder why all functions have the praefix "o_". 
  8.            That is easy to explaine: The original name of the progam 
  9.            was oszi.c but we had to change the name because it was 
  10.            not English enough.
  11.                     Small parts of graph.c are in the programs ui_remoteP.c 
  12.            and ui_fileP.c
  13.  
  14.   AUTHOR         : Markus Heuttel and Michael Schmalzl
  15.   DATE           : 3.4.1992
  16.  
  17.   CHANGED BY     :
  18.   IDENTIFICATION : @(#)o_graph.c    1.15 3/30/94
  19.   SCCS VERSION   : 1.15
  20.   LAST CHANGE    : 3/30/94
  21.  
  22.              Copyright (c) 1990-1994  SNNS Group, IPVR, Univ. Stuttgart, FRG
  23.              
  24. ******************************************************************************/
  25.  
  26.  
  27. #include <stdio.h>
  28. #include <malloc.h>
  29.  
  30. #include <X11/Xlib.h>
  31. #include <X11/Xutil.h>
  32. #include <X11/Xos.h>
  33. #include <X11/cursorfont.h>
  34. #include <X11/Intrinsic.h>
  35. #include <X11/StringDefs.h>
  36. #include <X11/Shell.h>
  37. #include <X11/Xaw/Box.h>
  38. #include <X11/Xaw/Simple.h>
  39. #include <X11/Xaw/Grip.h>
  40. #include <X11/Xaw/Form.h>
  41. #include <X11/Xaw/SmeBSB.h>
  42. #include <X11/Xaw/SmeLine.h>
  43. #include <X11/Xaw/Viewport.h>
  44. #include <X11/Xaw/Label.h>
  45. #include <X11/Xaw/Toggle.h>
  46. #include <X11/Xaw/Command.h>
  47. #include <X11/Xaw/Cardinals.h>
  48. #include <X11/Xaw/AsciiText.h>
  49. #include <X11/Xaw/Scrollbar.h>
  50.  
  51. #include "ui.h"
  52. #include "ui_xWidgets.h"
  53. #include "ui_textP.h"
  54. #include "ui_main.h"
  55. #include "ui_mainP.h"
  56.  
  57.  
  58. #include "done.xbm"
  59. #include "clear.xbm"
  60. #include "prev.xbm"
  61. #include "next.xbm"
  62.  
  63. #include "o_graph.ph"
  64.  
  65.  
  66.     /***************** Begin: Performance Functions *********************/
  67.  
  68.  
  69. /*****************************************************************************
  70.   FUNCTION : o_createOszi
  71.  
  72.   PURPOSE  : creates the  window GRAPH
  73.   RETURNS  : void
  74.   NOTES    :
  75.  
  76.   UPDATE   : 20.12.1991
  77. ******************************************************************************/
  78.  
  79. void o_createOszi (void)
  80.  
  81. {
  82.  Widget       form,w1,w2;
  83.  Widget       Done_oszi, clear_oszi;
  84.  Arg          arg[5];
  85.  Cardinal     n;
  86.  char         buf[40];
  87.  unsigned long foreground,background;
  88.  int          curr_unit,test_unit,
  89.               count_unit = 0;
  90.  
  91.  
  92.  /* test whether there are output units defined. Since no error can be 
  93.     computed in the opposit case, the graph tool can not be used */
  94.  curr_unit  = krui_getCurrentUnit();
  95.  test_unit  = krui_getFirstUnit();
  96.  do{
  97.      if((n=krui_getUnitTType(test_unit)) == 2) count_unit = 1;
  98.  }while((test_unit  = krui_getNextUnit()) && (count_unit == 0));
  99.  curr_unit  = krui_setCurrentUnit(curr_unit);
  100.  
  101.  if(count_unit == 0){
  102.     ui_confirmOk("No Output units defined!\nAn error can neither be\ncomputed nor displayed!");
  103.    return;
  104.  }
  105.  
  106.  
  107.  if(!o_open) {
  108.    o_open = 1; 
  109.    o_init();
  110.     
  111.    sprintf (buf, "graph");
  112.    n = 0;  
  113.  
  114.    XtSetArg(arg[n],XtNminHeight,200); n++;
  115.    XtSetArg(arg[n],XtNminWidth,400); n++;  
  116.    XtSetArg(arg[n],XtNheight,o_WindowHeight+29); n++;
  117.    XtSetArg(arg[n],XtNwidth,o_WindowWidth+10); n++;
  118.  
  119.    o_displayMainWidget = XtCreatePopupShell (buf, topLevelShellWidgetClass, ui_toplevel, arg, n); 
  120.    n = 0;  
  121.    form = XtCreateManagedWidget ("form", formWidgetClass, o_displayMainWidget, arg, n);
  122.  
  123.     Done_oszi = o_xCreateButtonItem ("Done",form,NULL,NULL);
  124.        XtAddCallback(Done_oszi,XtNcallback,(XtCallbackProc) o_DoneProc,NULL);
  125.  
  126.     clear_oszi = o_xCreateButtonItem ("Clear",form,Done_oszi,NULL);
  127.        XtAddCallback(clear_oszi,XtNcallback,(XtCallbackProc) o_clearProc,NULL);
  128.  
  129.     w1 = ui_xCreateLabelItem ("Scale X: ",form,8*8,clear_oszi,NULL); 
  130.     w2 = o_xCreateButtonItem ("prev",form,w1,NULL);
  131.       XtAddCallback(w2,XtNcallback,(XtCallbackProc) o_XForwardProc,NULL);
  132.     w1 = o_xCreateButtonItem ("next",form,w2,NULL);
  133.       XtAddCallback(w1,XtNcallback,(XtCallbackProc) o_XBackProc,NULL);
  134.  
  135.     w2 = ui_xCreateLabelItem ("  Scale Y: ",form,10*8,w1,NULL); 
  136.     w1 = o_xCreateButtonItem ("prev",form,w2,NULL); 
  137.       XtAddCallback(w1,XtNcallback,(XtCallbackProc) o_YBackProc,NULL);
  138.     w2 = o_xCreateButtonItem ("next",form,w1,NULL);
  139.       XtAddCallback(w2,XtNcallback,(XtCallbackProc) o_YForwardProc,NULL);
  140.  
  141.     o_DisplayWidget = o_xCreateScreenItem("screen",form,o_WindowWidth,o_WindowHeight,NULL,Done_oszi);
  142.        XtAddEventHandler(o_DisplayWidget,StructureNotifyMask | ExposureMask, 
  143.         FALSE,(XtEventHandler) o_eventProc,o_display);
  144.  
  145.     ui_checkWindowPosition(o_displayMainWidget);
  146.     XtPopup (o_displayMainWidget, XtGrabNone);
  147.  
  148.     o_display = XtDisplay (o_DisplayWidget); 
  149.     o_window = XtWindow (o_DisplayWidget);
  150.     o_fontStruct = XLoadQueryFont(o_display, "6x12");
  151.  
  152.     o_gc = XCreateGC (o_display, o_window, ZERO, NULL);
  153.     XSetFont(o_display,o_gc,(*o_fontStruct).fid);
  154.     o_screen = DefaultScreen (o_display);
  155.  
  156.     o_depth = DisplayPlanes(o_display,o_screen);
  157.  
  158.     background = WhitePixel (o_display, o_screen);
  159.     foreground = BlackPixel (o_display, o_screen); 
  160.    /* XSetWindowBackground(o_display,o_window,background); */
  161.     XSetBackground (o_display, o_gc, background);
  162.     XSetForeground (o_display, o_gc, foreground); 
  163.  
  164.     XSetGraphicsExposures(o_display,o_gc,0);
  165.  
  166.     o_Pixmap = XCreatePixmap(o_display,o_window,(unsigned int) o_PixmapWidth, 
  167.     (unsigned int) o_PixmapHeight, (unsigned int) o_depth);
  168.     o_ClearPixmap(o_display,o_Pixmap,o_gc,o_screen,0,0,o_PixmapWidth,o_PixmapHeight); 
  169.     XClearArea(o_display,o_window,o_OsziXPos,o_OsziYPos, 
  170.     (unsigned int) o_OsziWidth-1, (unsigned int) o_OsziHeight,1);
  171.    } 
  172. }
  173.  
  174.  
  175. /*****************************************************************************
  176.   FUNCTION : o_eventProc
  177.  
  178.   PURPOSE  : Manages the events (resize and exposure)
  179.   RETURNS  : void
  180.   NOTES    :
  181.  
  182.   UPDATE   : 3.4.1992
  183. ******************************************************************************/
  184.  
  185. static void o_eventProc (Widget w, Display *display, XEvent *event)
  186.  
  187. {
  188.  switch (event->type) {
  189.    case Expose: {
  190.      if(event->xexpose.count == 0) {
  191.          XCopyArea(o_display,o_Pixmap,o_window,o_gc,0,0,(unsigned int) o_OsziWidth, (unsigned int) o_OsziHeight,o_OsziXPos,o_OsziYPos);
  192.          XDrawRectangle(o_display,o_window,o_gc,o_OsziFrameXPos,o_OsziFrameYPos, (unsigned int) o_OsziWidth+1, (unsigned int) o_OsziHeight);
  193.          o_ScaleY(o_display,o_window,o_gc);
  194.          o_ScaleX(o_display,o_window,o_gc);
  195.      }
  196.      break;
  197.    }
  198.    case ConfigureNotify: {
  199.      o_ResizeOszi(event->xconfigure.width,event->xconfigure.height);
  200.      break;
  201.    }
  202.  }     
  203. }
  204.  
  205.  
  206. /*****************************************************************************
  207.   FUNCTION : o_clearProc
  208.  
  209.   PURPOSE  : callback function of the clear-buttom. 
  210.              Clears all curves of the display.
  211.   RETURNS  : void
  212.   NOTES    :
  213.  
  214.   UPDATE   : 3.4.1992
  215. ******************************************************************************/
  216.  
  217. static void o_clearProc (void)
  218.  
  219. {
  220.  if(o_PressPossible){
  221.    o_ClearPixmap(o_display,o_Pixmap,o_gc,o_screen,0,0,o_PixmapWidth,o_PixmapHeight);
  222.    XClearArea(o_display,o_window,o_OsziXPos,o_OsziYPos,(unsigned int) o_OsziWidth,(unsigned int) o_OsziHeight-1,1);
  223.    o_ClearCurves();
  224.    o_LearnStepCount = 0;
  225.  }
  226. }
  227.  
  228.  
  229. /*****************************************************************************
  230.   FUNCTION : o_DoneProc
  231.  
  232.   PURPOSE  : callback function of the done-buttom. You are leaving bignet.A
  233.   RETURNS  : void
  234.   NOTES    :
  235.  
  236.   UPDATE   : 3.4.1992
  237. ******************************************************************************/
  238.  
  239. static void o_DoneProc (void)
  240.  
  241. {
  242.  if(o_PressPossible){
  243.    o_clearProc();
  244.    XtDestroyWidget(o_displayMainWidget);
  245.    o_open = 0;
  246.  }
  247. }
  248.  
  249.  
  250. /*****************************************************************************
  251.   FUNCTION : o_xCreateButtonItem
  252.  
  253.   PURPOSE  : create a command widget
  254.   RETURNS  : Widget
  255.   NOTES    :
  256.  
  257.   UPDATE   : 3.4.1992
  258. ******************************************************************************/
  259.  
  260. static Widget o_xCreateButtonItem (char *name, Widget parent, Widget left, Widget top)
  261.  
  262. {
  263.     int n;
  264.     Widget   w;
  265.     Arg      arg[15];
  266.     
  267.     n = 0;
  268.  
  269.     if (strcmp (name, "Done") == 0)
  270.       {  
  271.         XtSetArg(arg[n], XtNbitmap, 
  272.                   (Pixmap) XCreateBitmapFromData (ui_display,
  273.                    XDefaultRootWindow (ui_display), 
  274.                    done_bits, done_width, done_height)); n++;
  275.       } 
  276.  
  277.     if (strcmp (name, "Clear") == 0)
  278.       {  
  279.         XtSetArg(arg[n], XtNbitmap, 
  280.                   (Pixmap) XCreateBitmapFromData (ui_display,
  281.                    XDefaultRootWindow (ui_display), 
  282.                    clear_bits, clear_width, clear_height)); n++;
  283.       } 
  284.  
  285.     if (strcmp (name, "prev") == 0)
  286.       {  
  287.         XtSetArg(arg[n], XtNbitmap, 
  288.                   (Pixmap) XCreateBitmapFromData (ui_display,
  289.                    XDefaultRootWindow (ui_display), 
  290.                    prev_bits, prev_width, prev_height)); n++;
  291.       } 
  292.  
  293.     if (strcmp (name, "next") == 0)
  294.       {  
  295.         XtSetArg(arg[n], XtNbitmap, 
  296.                   (Pixmap) XCreateBitmapFromData (ui_display,
  297.                    XDefaultRootWindow (ui_display), 
  298.                    next_bits, next_width, next_height)); n++;
  299.       } 
  300.  
  301.     XtSetArg(arg[n], XtNborderWidth, 0); n++;
  302.     XtSetArg(arg[n], XtNinternalHeight, 1); n++;
  303.     XtSetArg(arg[n], XtNinternalWidth , 1); n++;
  304.  
  305.     XtSetArg(arg[n], XtNfromVert , top);  n++;
  306.     XtSetArg(arg[n], XtNfromHoriz, left);  n++;
  307.     XtSetArg(arg[n], XtNleft  , XtChainLeft); n++;
  308.     XtSetArg(arg[n], XtNright , XtChainLeft); n++;
  309.     XtSetArg(arg[n], XtNtop   , XtChainTop); n++;
  310.     XtSetArg(arg[n], XtNbottom, XtChainTop); n++;
  311.  
  312.     w = XtCreateManagedWidget(name, commandWidgetClass, parent, arg, 
  313.     (unsigned int) n);
  314.     return(w);
  315. }
  316.  
  317.  
  318. /*****************************************************************************
  319.   FUNCTION : o_xCreateScreenItem
  320.  
  321.   PURPOSE  : Creates the widget on which the curves are drawn.
  322.   RETURNS  : Widget
  323.   NOTES    :
  324.  
  325.   UPDATE   : 3.4.1992
  326. ******************************************************************************/
  327.  
  328. static Widget   o_xCreateScreenItem (char *name, Widget parent, Dimension width, 
  329.     Dimension height, Widget left, Widget top)
  330.  
  331.     Cardinal n;
  332.     Widget   w;
  333.     Arg      args[15];
  334.  
  335.     n = 0;
  336.     XtSetArg(args[n], XtNheight,height); n++;
  337.     XtSetArg(args[n], XtNwidth,width); n++;
  338.     XtSetArg(args[n], XtNfromVert , top);  n++;
  339.  
  340.     XtSetArg(args[n], XtNleft  , XtChainLeft); n++;
  341.     XtSetArg(args[n], XtNright , XtChainRight); n++;
  342.     XtSetArg(args[n], XtNtop   , XtChainTop); n++;
  343.     XtSetArg(args[n], XtNbottom, XtChainBottom); n++;
  344.  
  345.    XtSetArg(args[n],XtNresizable,True); n++;
  346.  
  347.     w = XtCreateManagedWidget(name, formWidgetClass, parent, args, n);
  348.  
  349.     return(w);
  350. }
  351.  
  352.  
  353. /*****************************************************************************
  354.   FUNCTION : o_XBackProc
  355.  
  356.   PURPOSE  : callback function which changes the scala of the x-axis. The scala
  357.              is enlarged. (You press the right x-buttom)
  358.   RETURNS  : void
  359.   NOTES    :
  360.  
  361.   UPDATE   : 3.4.1992
  362. ******************************************************************************/
  363.  
  364. static void o_XBackProc (void)
  365.  
  366. {
  367.  if(o_PressPossible){
  368.    o_XBack();
  369.  }
  370. }
  371.  
  372.  
  373. /*****************************************************************************
  374.   FUNCTION : o_XForwardProc
  375.  
  376.   PURPOSE  : callback function which changes the scala of the x-axis. The scala
  377.              is lessened. (You press the left x-buttom)
  378.   RETURNS  : void
  379.   NOTES    :
  380.  
  381.   UPDATE   : 3.4.1992
  382. ******************************************************************************/
  383.  
  384. static void o_XForwardProc (void)
  385.  
  386. {
  387.  if(o_PressPossible){
  388.    o_XForward();
  389.  }
  390. }
  391.  
  392.  
  393. /*****************************************************************************
  394.   FUNCTION : o_YBackProc
  395.  
  396.   PURPOSE  : callback function which changes the scala of the y-axis. The scala
  397.              is lessened. (You press the left y-buttom)
  398.   RETURNS  : void
  399.   NOTES    : That's just the other way round as o_XBackProc!
  400.  
  401.   UPDATE   : 3.4.1992
  402. ******************************************************************************/
  403.  
  404. static void o_YBackProc (void)
  405.  
  406. {
  407.  if(o_PressPossible){
  408.    o_YBack();
  409.  }
  410. }
  411.  
  412.  
  413. /*****************************************************************************
  414.   FUNCTION : o_YForwardProc
  415.  
  416.   PURPOSE  : callback function which changes the scala of the y-axis. The scala
  417.              is enlarged. (You press the right y-buttom)
  418.   RETURNS  : void
  419.   NOTES    : That's just the other way round as o_XForwardProc!
  420.  
  421.   UPDATE   : 3.4.1992
  422. ******************************************************************************/
  423.  
  424. static void o_YForwardProc (void)
  425.  
  426. {
  427.  if(o_PressPossible){
  428.    o_YForward();
  429.  }
  430. }
  431.  
  432.  
  433.     /***************** End: Performance Functions *********************/
  434.  
  435.  
  436. /*****************************************************************************
  437.   FUNCTION : o_init
  438.  
  439.   PURPOSE  : Initializes all variables of GRAPH. 
  440.   RETURNS  : void
  441.   NOTES    :
  442.  
  443.   UPDATE   : 20.12.1991
  444. ******************************************************************************/
  445.  
  446. static void o_init (void)
  447.  
  448. {
  449.  int i;
  450.  
  451.  o_WindowWidth = 490;
  452.  o_WindowHeight = 250;
  453.  
  454.  o_LearnStepCount = 0;
  455.  o_YCounter = 3;
  456.  o_XCounter = 9;
  457.  
  458.  o_PixelsOfOneLearningStep = o_XScaleValues[o_XCounter].ScreenEinheit/o_XScaleValues[o_XCounter].Einheit; 
  459.  o_PixelsOfOneLearningStep = ((o_PixelsOfOneLearningStep == 0) ? (1) : (o_PixelsOfOneLearningStep));
  460.  o_LearningStepsOfOnePixel = o_XScaleValues[o_XCounter].Einheit/o_XScaleValues[o_XCounter].ScreenEinheit;
  461.  o_LearningStepsOfOnePixel = ((o_LearningStepsOfOnePixel == 1) ? (0) : (o_LearningStepsOfOnePixel));
  462.  
  463.  o_AbsoluteScale = (float)o_YScaleValues[o_YCounter].ScreenEinheit/(float)o_YScaleValues[o_YCounter].Einheit;
  464.  
  465.  o_RightOffset      = o_PixelsOfOneLearningStep;
  466.  o_OsziXPos         = o_SpaceLeft;
  467.  o_OsziYPos         = o_SpaceAbove;
  468.  o_OsziHeight       = 200;  
  469.  o_OsziWidth        = 400; 
  470.  o_PixmapWidth      = o_OsziWidth+o_RightOffset;
  471.  o_PixmapHeight     = o_OsziHeight;
  472.  o_OsziFrameXPos   = o_OsziXPos - 1; 
  473.  o_OsziFrameYPos   = o_OsziYPos - 1;
  474.  o_OsziFrameWidth  = o_OsziWidth + 2;
  475.  o_OsziFrameHeight = o_OsziHeight + 2;
  476.  o_MaxYDrawPos      = o_OsziHeight-1;
  477.  
  478.  o_CurveNo = 0;
  479.  for(i=0;i<MAX_CURVE_NO;i++) {
  480.    o_CurveLengths[i] = -1;
  481.  }
  482.  o_InitCurve();
  483. }
  484.  
  485.  
  486. /*****************************************************************************
  487.   FUNCTION : o_InitCurve
  488.  
  489.   PURPOSE  : Allocates space for a new curve.
  490.   RETURNS  : void
  491.   NOTES    :
  492.  
  493.   UPDATE   : 20.12.1991
  494. ******************************************************************************/
  495.  
  496. void o_InitCurve (void)
  497.  
  498. {
  499.  char buf[80];
  500.  
  501.  if(o_open && (o_CurveLengths[o_CurveNo] != 0)) {
  502.    if(o_CurveLengths[o_CurveNo] == -1) {
  503.      o_DrawAllowed = 1;
  504.      o_MaxCurveLengths = (int)(o_OsziWidth/o_PixelsOfOneLearningStep);
  505.      o_Curve1[o_CurveNo] = (XPoint *)malloc(sizeof(XPoint)*o_MaxCurveLengths);
  506.      o_Curve2[o_CurveNo]   = (MPoint *)malloc(sizeof(MPoint)*o_MaxCurveLengths);
  507.      o_CurveLengths[o_CurveNo] = 0;
  508.      o_Curve1[o_CurveNo][0].x = -1;
  509.      o_Curve1[o_CurveNo][0].y = -1;
  510.      o_Curve2[o_CurveNo][0].x =  0;
  511.      o_Curve2[o_CurveNo][0].y =  0;
  512.    }
  513.    else {
  514.      o_DrawAllowed = 0;
  515.      sprintf(buf,"The max no of curves you can draw is %d",MAX_CURVE_NO);
  516.      ui_tw_errorMessage(buf);
  517.    }
  518.  }
  519. }
  520.  
  521.  
  522. /*****************************************************************************
  523.   FUNCTION : o_ClearCurves
  524.  
  525.   PURPOSE  : Deletes all curves. (The curves vanish from display and the 
  526.              storage is set free.
  527.   RETURNS  : void
  528.   NOTES    :
  529.  
  530.   UPDATE   : 3.4.1992
  531. ******************************************************************************/
  532.  
  533. static void o_ClearCurves (void)
  534.  
  535. {
  536.  /* Old Style: for(o_CurveNo;o_CurveNo>=0;o_CurveNo--) */
  537.  for(;o_CurveNo>=0;o_CurveNo--) 
  538.    {
  539.    o_CurveLengths[o_CurveNo]= -1;
  540.    free(o_Curve1[o_CurveNo]);
  541.    free(o_Curve2[o_CurveNo]);
  542.  }
  543.  o_CurveNo = 0;
  544.  o_InitCurve();
  545. }
  546.  
  547.  
  548. /*****************************************************************************
  549.   FUNCTION : o_ResizeOszi
  550.  
  551.   PURPOSE  : This function is called when there is a risize event by the 
  552.              X-server. The variables are initialized with their new values,
  553.              the storage for the current curve (only for this one) is 
  554.          reallocated and the curves are drawn again.
  555.   RETURNS  : void
  556.   NOTES    :
  557.  
  558.   UPDATE   : 3.4.1992
  559. ******************************************************************************/
  560.  
  561. static void o_ResizeOszi (int box_width, int box_height)
  562.  
  563. {
  564.  int Length,UsedStorage,NeededStorage,FreeStorage,x;
  565.  int i,j;
  566.  
  567.  o_WindowWidth = box_width;
  568.  o_WindowHeight = box_height;
  569.  
  570.  o_PixelsOfOneLearningStep = o_XScaleValues[o_XCounter].ScreenEinheit/o_XScaleValues[o_XCounter].Einheit;
  571.  o_PixelsOfOneLearningStep = ((o_PixelsOfOneLearningStep == 0) ? (1) : (o_PixelsOfOneLearningStep));
  572.  o_LearningStepsOfOnePixel = o_XScaleValues[o_XCounter].Einheit/o_XScaleValues[o_XCounter].ScreenEinheit;
  573.  o_LearningStepsOfOnePixel = ((o_LearningStepsOfOnePixel == 1) ? (0) : (o_LearningStepsOfOnePixel));
  574.  
  575.  o_RightOffset      = o_PixelsOfOneLearningStep;
  576.  o_OsziHeight       = o_WindowHeight-o_SpaceAbove-o_SpaceBelow;  
  577.  o_OsziWidth        = o_WindowWidth-o_SpaceLeft-o_SpaceRight;
  578.  o_PixmapWidth      = o_OsziWidth+o_RightOffset;
  579.  o_PixmapHeight     = o_OsziHeight;
  580.  o_OsziFrameWidth   = o_OsziWidth + 2;
  581.  o_OsziFrameHeight  = o_OsziHeight + 2;
  582.  o_MaxYDrawPos      = o_OsziHeight-1;
  583.  
  584.  for(i=0;i<=o_CurveNo;i++) {
  585.    for(j=0;j<o_CurveLengths[i];j++) {
  586.      o_Curve1[i][j].y = (int) (o_MaxYDrawPos-(o_Curve2[i][j].y*o_AbsoluteScale));
  587.    }
  588.  }
  589.  
  590.  Length = ((o_CurveLengths[o_CurveNo]-1 == -1)?(0):(o_CurveLengths[o_CurveNo]-1)); 
  591.  x = ((o_Curve1[o_CurveNo][Length].x == -1)?(0):(o_Curve1[o_CurveNo][Length].x)); 
  592.  UsedStorage = o_CurveLengths[o_CurveNo];
  593.  FreeStorage = (int)((o_OsziWidth-x)/o_PixelsOfOneLearningStep);
  594.  NeededStorage = ((FreeStorage <= 0)?(0):(FreeStorage+UsedStorage));
  595.  
  596.  if(NeededStorage > UsedStorage) {
  597.    o_Curve1[o_CurveNo] = (XPoint *)realloc(o_Curve1[o_CurveNo],NeededStorage*sizeof(XPoint));
  598.    o_Curve2[o_CurveNo] = (MPoint *)realloc(o_Curve2[o_CurveNo],NeededStorage*sizeof(MPoint));
  599.    o_MaxCurveLengths = NeededStorage;
  600.  }
  601.  
  602.  XFreePixmap(o_display,o_Pixmap);
  603.  o_Pixmap = XCreatePixmap(o_display,o_window,(unsigned int) o_PixmapWidth, (unsigned int) o_PixmapHeight, (unsigned int) o_depth);
  604.  o_ClearPixmap(o_display,o_Pixmap,o_gc,o_screen,0,0,o_PixmapWidth,o_PixmapHeight); 
  605.  for(i=0;i<=o_CurveNo;i++) {
  606.    XDrawLines(o_display,o_Pixmap,o_gc,o_Curve1[i],o_CurveLengths[i],CoordModeOrigin);
  607.  }
  608.  XClearArea(o_display,o_window,0,0,(unsigned int) o_WindowWidth, (unsigned int) o_WindowHeight,0); 
  609.  XCopyArea(o_display,o_Pixmap,o_window,o_gc,0,0,(unsigned int) o_OsziWidth,(unsigned int) o_OsziHeight,o_OsziXPos,o_OsziYPos);
  610.  XDrawRectangle(o_display,o_window,o_gc,o_OsziFrameXPos,o_OsziFrameYPos,
  611.     (unsigned int) o_OsziWidth+1, (unsigned int) o_OsziHeight);
  612.  o_ScaleY(o_display,o_window,o_gc); 
  613.  o_ScaleX(o_display,o_window,o_gc); 
  614. }
  615.  
  616.  
  617. /*****************************************************************************
  618.   FUNCTION : o_XScaleCurve
  619.  
  620.   PURPOSE  : After the size of the x-scala has changed, the pixel position
  621.              of the x-values must be calculated again. (Remember: the array
  622.              Curve1 contains the pixel positions of the curves, while the
  623.              array Curve2 contains the number of learnsteps as x-value and
  624.              the learn-error as y-value.)
  625.   RETURNS  : void
  626.   NOTES    : Is called by o_XBack and by o_XForward.
  627.  
  628.   UPDATE   : 3.4.1992
  629. ******************************************************************************/
  630.  
  631. static void o_XScaleCurve (void)
  632.  
  633. {
  634.  int i,j,tmp_Curve1_x;
  635.  double PixelsOfOneLearningStep;
  636.    
  637.  for(i=0;i<=o_CurveNo;i++) {
  638.    PixelsOfOneLearningStep = o_XScaleValues[o_XCounter].ScreenEinheit/o_XScaleValues[o_XCounter].Einheit;
  639.    for(j=0;j<o_CurveLengths[i];j++) {
  640.      tmp_Curve1_x = o_Curve2[i][j].x*PixelsOfOneLearningStep-1;
  641.      /* 
  642.         This is necessery to prevent too large values for o_Curve1[i][j].x, which is of the type "short" (XPoint),
  643.         when scaling downward. 
  644.      */ 
  645.      o_Curve1[i][j].x = (tmp_Curve1_x > 32767) ? (32767) : (tmp_Curve1_x);
  646.    }
  647.  }
  648. }
  649.  
  650.  
  651. /*****************************************************************************
  652.   FUNCTION : o_XBack
  653.  
  654.   PURPOSE  : The scala of the x-axis is enlarged. The variables have to be 
  655.              initialized with new values and the storage of the current curve 
  656.              (only for this one) has to be reallocated. Before drawing all 
  657.              visible curves, the function o_XScaleCurve() must be called.
  658.   RETURNS  : void
  659.   NOTES    :
  660.  
  661.   UPDATE   : 3.4.1992
  662. ******************************************************************************/
  663.  
  664. static void o_XBack (void)
  665.  
  666. {
  667.  int i,Length;
  668.  double PixelsOfOneLearningStep;
  669.  int UsedStorage,FreeStorage,NeededStorage;
  670.  
  671.  o_XCounter = (--o_XCounter < 0) ? (0) : (o_XCounter);
  672.  
  673.  o_PixelsOfOneLearningStep = PixelsOfOneLearningStep = o_XScaleValues[o_XCounter].ScreenEinheit/o_XScaleValues[o_XCounter].Einheit;
  674.  o_PixelsOfOneLearningStep = ((o_PixelsOfOneLearningStep == 0) ? (1) : (o_PixelsOfOneLearningStep));
  675.  o_LearningStepsOfOnePixel = o_XScaleValues[o_XCounter].Einheit/o_XScaleValues[o_XCounter].ScreenEinheit;
  676.  o_LearningStepsOfOnePixel = ((o_LearningStepsOfOnePixel == 1) ? (0) : (o_LearningStepsOfOnePixel));
  677.  
  678.  Length = (o_CurveLengths[o_CurveNo]-1 == -1)?(0):(o_CurveLengths[o_CurveNo]-1);
  679.  UsedStorage = o_CurveLengths[o_CurveNo];
  680.  FreeStorage = (int)((o_OsziWidth-(o_Curve2[o_CurveNo][Length].x*PixelsOfOneLearningStep-1))/o_PixelsOfOneLearningStep);
  681.  NeededStorage = ((FreeStorage <= 0)?(0):(FreeStorage+UsedStorage));
  682.  
  683.  if(NeededStorage>o_MaxCurveLengths){
  684.    o_Curve1[o_CurveNo] = (XPoint *)realloc(o_Curve1[o_CurveNo],NeededStorage*sizeof(XPoint));
  685.    o_Curve2[o_CurveNo] = (MPoint *)realloc(o_Curve2[o_CurveNo],NeededStorage*sizeof(MPoint));
  686.    o_MaxCurveLengths = NeededStorage;
  687.  }
  688.  o_XScaleCurve();
  689.  XClearArea(o_display,o_window,0,0,(unsigned int) o_WindowWidth,(unsigned int) o_WindowHeight,0); 
  690.  o_ScaleY(o_display,o_window,o_gc); 
  691.  o_ScaleX(o_display,o_window,o_gc); 
  692.  o_ClearPixmap(o_display,o_Pixmap,o_gc,o_screen,0,0,o_PixmapWidth,o_PixmapHeight); 
  693.  for(i=0;i<=o_CurveNo;i++) {
  694.    XDrawLines(o_display,o_Pixmap,o_gc,o_Curve1[i],o_CurveLengths[i],CoordModeOrigin);
  695.  } 
  696.  XCopyArea(o_display,o_Pixmap,o_window,o_gc,0,0,(unsigned int) o_OsziWidth,
  697.     (unsigned int) o_OsziHeight,o_OsziXPos,o_OsziYPos);
  698.  XDrawRectangle(o_display,o_window,o_gc,o_OsziFrameXPos,o_OsziFrameYPos,
  699.     (unsigned int) o_OsziWidth+1,(unsigned int) o_OsziHeight);
  700.  }
  701.  
  702.  
  703. /*****************************************************************************
  704.   FUNCTION : o_XForward
  705.  
  706.   PURPOSE  : The scala of the x-axis is lessened. The variables have to be 
  707.              initialized with new values and the storage of the current curve 
  708.              (only for this one) has to be reallocated. Before drawing all 
  709.              visible curves, the function o_XScaleCurve() must be called. 
  710.   RETURNS  : void
  711.   NOTES    :
  712.  
  713.   UPDATE   : 3.4.1992
  714. ******************************************************************************/
  715.  
  716. static void o_XForward (void)
  717.  
  718. {
  719.  int i,Length;
  720.  double PixelsOfOneLearningStep;
  721.  int UsedStorage,FreeStorage,NeededStorage;
  722.  
  723.  if(o_XCounter != 14){ 
  724.    o_XCounter++;
  725.  
  726.    o_PixelsOfOneLearningStep = PixelsOfOneLearningStep = o_XScaleValues[o_XCounter].ScreenEinheit/o_XScaleValues[o_XCounter].Einheit;
  727.    o_PixelsOfOneLearningStep = ((o_PixelsOfOneLearningStep == 0) ? (1) : (o_PixelsOfOneLearningStep));
  728.    o_LearningStepsOfOnePixel = o_XScaleValues[o_XCounter].Einheit/o_XScaleValues[o_XCounter].ScreenEinheit;
  729.    o_LearningStepsOfOnePixel = ((o_LearningStepsOfOnePixel == 1) ? (0) : (o_LearningStepsOfOnePixel));
  730.  
  731.    Length = (o_CurveLengths[o_CurveNo]-1 == -1)?(0):(o_CurveLengths[o_CurveNo]-1);
  732.  
  733.    UsedStorage = o_CurveLengths[o_CurveNo];
  734.    FreeStorage = (int)((o_OsziWidth-(o_Curve2[o_CurveNo][Length].x*PixelsOfOneLearningStep-1))/o_PixelsOfOneLearningStep);
  735.    NeededStorage = ((FreeStorage <= 0)?(0):(FreeStorage+UsedStorage));
  736.  
  737.    if(NeededStorage){
  738.      o_Curve1[o_CurveNo] = (XPoint *)realloc(o_Curve1[o_CurveNo],NeededStorage*sizeof(XPoint));
  739.      o_Curve2[o_CurveNo] = (MPoint *)realloc(o_Curve2[o_CurveNo],NeededStorage*sizeof(MPoint));
  740.      o_MaxCurveLengths = NeededStorage;
  741.    }
  742.    o_XScaleCurve();
  743.    XClearArea(o_display,o_window,0,0,(unsigned int) o_WindowWidth,(unsigned int) o_WindowHeight,0); 
  744.    o_ScaleY(o_display,o_window,o_gc); 
  745.    o_ScaleX(o_display,o_window,o_gc); 
  746.    o_ClearPixmap(o_display,o_Pixmap,o_gc,o_screen,0,0,o_PixmapWidth,o_PixmapHeight); 
  747.    for(i=0;i<=o_CurveNo;i++) {
  748.      XDrawLines(o_display,o_Pixmap,o_gc,o_Curve1[i],o_CurveLengths[i],CoordModeOrigin);
  749.    }
  750.    XCopyArea(o_display,o_Pixmap,o_window,o_gc,0,0,(unsigned int) o_OsziWidth,(unsigned int) o_OsziHeight,o_OsziXPos,o_OsziYPos);
  751.    XDrawRectangle(o_display,o_window,o_gc,o_OsziFrameXPos,o_OsziFrameYPos,
  752.     (unsigned int) o_OsziWidth+1,(unsigned int) o_OsziHeight);
  753.  }
  754. }
  755.  
  756.  
  757. /*****************************************************************************
  758.   FUNCTION : o_YScaleCurve
  759.  
  760.   PURPOSE  : After the size of the y-scala has changed, the pixel position
  761.              of the y-values must be calculated again. (Remember: the array
  762.              Curve1 contains the pixel positions of the curves, while the
  763.              array Curve2 contains the number of learnsteps as x-value and
  764.              the learn-error as y-value.)
  765.   RETURNS  : void
  766.   NOTES    : Is called by o_YForwardCurve() and o_YBack().
  767.  
  768.   UPDATE   : 3.4.1992
  769. ******************************************************************************/
  770.  
  771. static void o_YScaleCurve (void)
  772.  
  773. {
  774.  int i,j;
  775.    
  776.  for(i=0;i<=o_CurveNo;i++) {
  777.    for(j=0;j<o_CurveLengths[i];j++) {
  778.      o_Curve1[i][j].y = (int) (o_MaxYDrawPos-(o_Curve2[i][j].y*o_AbsoluteScale));
  779.    }
  780.  }
  781. }
  782.  
  783.  
  784. /*****************************************************************************
  785.   FUNCTION : o_YForward
  786.  
  787.   PURPOSE  : The scala of the y-axis is enlarged. The variables have to be 
  788.              initialized with new values and the storage of the current curve 
  789.              (only for this one) has to be reallocated. Before drawing all 
  790.              visible curves, the function o_YScaleCurve() must be called.
  791.   RETURNS  : void
  792.   NOTES    :
  793.  
  794.   UPDATE   : 3.4.1992
  795. ******************************************************************************/
  796.  
  797. static void o_YForward (void)
  798.  
  799. {
  800.  int i;
  801.  
  802.  o_YCounter = (++o_YCounter > 14) ? (14) : (o_YCounter);
  803.  
  804.  o_AbsoluteScale = (float)o_YScaleValues[o_YCounter].ScreenEinheit/(float)o_YScaleValues[o_YCounter].Einheit;
  805.  
  806.  o_YScaleCurve();
  807.  XClearArea(o_display,o_window,0,0,(unsigned int) o_WindowWidth,(unsigned int) o_WindowHeight,0);  
  808.  o_ScaleY(o_display,o_window,o_gc); 
  809.  o_ScaleX(o_display,o_window,o_gc);
  810.  o_ClearPixmap(o_display,o_Pixmap,o_gc,o_screen,0,0,o_PixmapWidth,o_PixmapHeight);
  811.  
  812.  for(i=0;i<=o_CurveNo;i++) {
  813.    XDrawLines(o_display,o_Pixmap,o_gc,o_Curve1[i],o_CurveLengths[i],CoordModeOrigin);
  814.  }
  815.  XCopyArea(o_display,o_Pixmap,o_window,o_gc,0,0,(unsigned int) o_OsziWidth, (unsigned int) o_OsziHeight,o_OsziXPos,o_OsziYPos);
  816.  XDrawRectangle(o_display,o_window,o_gc,o_OsziFrameXPos,o_OsziFrameYPos,(unsigned int) o_OsziWidth+1,(unsigned int) o_OsziHeight);
  817. }
  818.  
  819.  
  820. /*****************************************************************************
  821.   FUNCTION : o_YBack
  822.  
  823.   PURPOSE  : The scala of the y-axis is lessened. The variables have to be 
  824.              initialized with new values and the storage of the current curve 
  825.              (only for this one) has to be reallocated. Before drawing all 
  826.              visible curves, the function o_YScaleCurve() must be called.
  827.   RETURNS  : void
  828.   NOTES    :
  829.  
  830.   UPDATE   : 3.4.1992
  831. ******************************************************************************/
  832.  
  833. static void o_YBack (void)
  834.  
  835. {
  836.  int i;
  837.  
  838.  o_YCounter = (--o_YCounter < 0) ? (0) : (o_YCounter);
  839.  
  840.  o_AbsoluteScale = (float)o_YScaleValues[o_YCounter].ScreenEinheit/(float)o_YScaleValues[o_YCounter].Einheit;
  841.  
  842.  o_YScaleCurve();
  843.  XClearArea(o_display,o_window,0,0,(unsigned int) o_WindowWidth,(unsigned int) o_WindowHeight,0);  
  844.  o_ScaleY(o_display,o_window,o_gc); 
  845.  o_ScaleX(o_display,o_window,o_gc);
  846.  o_ClearPixmap(o_display,o_Pixmap,o_gc,o_screen,0,0,o_PixmapWidth,o_PixmapHeight);
  847.  
  848.  for(i=0;i<=o_CurveNo;i++) {
  849.    XDrawLines(o_display,o_Pixmap,o_gc,o_Curve1[i],o_CurveLengths[i],CoordModeOrigin);
  850.  }
  851.  XCopyArea(o_display,o_Pixmap,o_window,o_gc,0,0,(unsigned int) o_OsziWidth,(unsigned int) o_OsziHeight,o_OsziXPos,o_OsziYPos);
  852.  
  853.  XDrawRectangle(o_display,o_window,o_gc,o_OsziFrameXPos,o_OsziFrameYPos,(unsigned int) o_OsziWidth+1,(unsigned int) o_OsziHeight);
  854. }
  855.  
  856.  
  857. /*****************************************************************************
  858.   FUNCTION : o_draw 
  859.  
  860.   PURPOSE  : draws the current curve and updates the arrays Curve1 and Curve2.
  861.   RETURNS  : void
  862.   NOTES    :
  863.  
  864.   UPDATE   : 3.4.1992
  865. ******************************************************************************/
  866.  
  867. void o_draw (float net_error)
  868.  
  869. {
  870.  double PixelsOfOneLearningStep;
  871.  int error;
  872.  int Length = o_CurveLengths[o_CurveNo];
  873.  int OldX=o_Curve1[o_CurveNo][(Length-1==-1)?(0):(Length-1)].x;
  874.  int OldY=o_Curve1[o_CurveNo][(Length-1==-1)?(0):(Length-1)].y;
  875.  int NewX =  (OldX+o_PixelsOfOneLearningStep);
  876.  
  877.  if(o_DrawAllowed) { 
  878.    o_LearnStepCount++;
  879.  
  880.    if(NewX >= o_OsziWidth) {
  881.      while((NewX >= o_OsziWidth) && (o_XCounter-- > 0)) {
  882.        PixelsOfOneLearningStep = o_XScaleValues[o_XCounter].ScreenEinheit/o_XScaleValues[o_XCounter].Einheit;
  883.        NewX = o_Curve2[o_CurveNo][o_CurveLengths[o_CurveNo]-1].x*PixelsOfOneLearningStep-1;
  884.      } 
  885.      if(NewX >= o_OsziWidth){
  886.        o_DrawAllowed = 0;
  887.      }
  888.      o_XCounter++; 
  889.      o_XBack();
  890.      OldX=o_Curve1[o_CurveNo][(Length-1==-1)?(0):(Length-1)].x;
  891.      NewX =  (OldX+o_PixelsOfOneLearningStep);
  892.    } 
  893.  
  894.    if(o_DrawAllowed) {
  895.      if(o_LearningStepsOfOnePixel == 0) { /* One learning step corresponds with at least one pixel */ 
  896.        error = (int) (o_MaxYDrawPos-(net_error*o_AbsoluteScale));
  897.        if(Length == 0) { /* first time */
  898.          XDrawPoint(o_display,o_Pixmap,o_gc,o_Curve1[o_CurveNo][Length].x=NewX,o_Curve1[o_CurveNo][Length].y=error=(error<0)?(-1):(error));
  899.          XDrawPoint(o_display,o_window,o_gc,NewX+o_SpaceLeft,error+o_SpaceAbove);
  900.        }
  901.        else { /* not first time */
  902.          XDrawLine(o_display,o_Pixmap,o_gc,OldX,OldY,o_Curve1[o_CurveNo][Length].x=NewX,o_Curve1[o_CurveNo][Length].y=error=(error<0)?(-1):(error));
  903.          XDrawLine(o_display,o_window,o_gc,OldX+o_SpaceLeft,OldY+o_SpaceAbove,NewX+o_SpaceLeft,error+o_SpaceAbove);
  904.        }
  905.        o_Curve2[o_CurveNo][Length].x = o_LearnStepCount;
  906.        o_Curve2[o_CurveNo][Length].y = (double)net_error;
  907.        o_CurveLengths[o_CurveNo]++;
  908.      }
  909.      else {  /* One pixel corresponds with more than one learning step */
  910.        if(!(o_LearnStepCount%o_LearningStepsOfOnePixel)) {
  911.          error  = (int) (o_MaxYDrawPos-(net_error*o_AbsoluteScale));
  912.          if(Length == 0) { /* first time */
  913.            XDrawPoint(o_display,o_Pixmap,o_gc,o_Curve1[o_CurveNo][Length].x=NewX,o_Curve1[o_CurveNo][Length].y=error=(error<0)?(-1):(error));
  914.            XDrawPoint(o_display,o_window,o_gc,NewX+o_SpaceLeft,error+o_SpaceAbove);
  915.          }
  916.          else { /* not first time */
  917.            XDrawLine(o_display,o_Pixmap,o_gc,OldX,OldY,o_Curve1[o_CurveNo][Length].x=NewX,o_Curve1[o_CurveNo][Length].y=error=(error<0)?(-1):(error));
  918.            XDrawLine(o_display,o_window,o_gc,OldX+o_SpaceLeft,OldY+o_SpaceAbove,NewX+o_SpaceLeft,error+o_SpaceAbove);
  919.          }
  920.          o_Curve2[o_CurveNo][Length].x = o_LearnStepCount;
  921.          o_Curve2[o_CurveNo][Length].y = (double)net_error;
  922.          o_CurveLengths[o_CurveNo]++;
  923.        }
  924.      }
  925.    }
  926.  }/* if(o_open) */
  927. }
  928.  
  929.  
  930. /*****************************************************************************
  931.   FUNCTION : o_ClearPixmap
  932.  
  933.   PURPOSE  : clears the pixmap
  934.   RETURNS  : void
  935.   NOTES    :
  936.  
  937.   UPDATE   : 3.4.1992
  938. ******************************************************************************/
  939.  
  940. static void o_ClearPixmap (Display *display, Drawable pixmap, GC gc, int screen, 
  941.     int x, int y, int width, int height)
  942.  
  943. {
  944.  XSetForeground (display,gc,WhitePixel(o_display, o_screen));
  945.  XFillRectangle(display,pixmap,gc,x,y,(unsigned int) width,(unsigned int) height);
  946.  XSetForeground(display,gc,BlackPixel(o_display, o_screen));
  947. }
  948.  
  949.  
  950. /*****************************************************************************
  951.   FUNCTION : o_ScaleY
  952.  
  953.   PURPOSE  : draws the y-axis.
  954.   RETURNS  : void
  955.   NOTES    :
  956.  
  957.   UPDATE   : 3.4.1992
  958. ******************************************************************************/
  959.  
  960. static void o_ScaleY (Display *my_display, Drawable my_window, GC my_gc)
  961.  
  962. {
  963.  int buflen;
  964.  char buf[10];
  965.  int count=0;
  966.  int y1,x1,x2,x3;
  967.  int FontWriteYPos = (*o_fontStruct).ascent>>1;
  968.  
  969.  y1 = o_OsziFrameYPos + o_OsziHeight;
  970.  x1 = o_OsziFrameXPos;
  971.  x2 = x1 - 6;
  972.  x3 = x1 - 3; 
  973.  
  974.  while(y1 >= o_OsziFrameYPos) {
  975.      XDrawLine(my_display,my_window,my_gc,x1,y1,x2,y1);   
  976.      sprintf(buf,"%6.2f",(count*(o_YScaleValues[o_YCounter].Einheit)));
  977.      buflen = strlen(buf);
  978.      XDrawString(o_display,o_window,o_gc,
  979.                    x2-XTextWidth(o_fontStruct,buf,buflen),y1+FontWriteYPos,buf,buflen); 
  980.    count++;
  981.    y1 -= o_YScaleValues[o_YCounter].ScreenEinheit;
  982.  }
  983. }
  984.  
  985.  
  986. /*****************************************************************************
  987.   FUNCTION : o_ScaleX
  988.  
  989.   PURPOSE  : draws the x-axix.
  990.   RETURNS  : void
  991.   NOTES    :
  992.  
  993.   UPDATE   : 3.4.1992
  994. ******************************************************************************/
  995.  
  996. static void o_ScaleX (Display *my_display, Drawable my_window, GC my_gc)
  997.  
  998. {
  999.  int buflen;
  1000.  int count=0;
  1001.  int x1,y1,y2,y3;
  1002.  char buf[10];
  1003.  int o_OsziFrameXPos_AND_o_OsziFrameWidth = o_OsziFrameXPos+o_OsziFrameWidth;
  1004.  int FontWriteXPos = (*o_fontStruct).ascent+2;
  1005.  
  1006.  x1 = o_OsziFrameXPos;
  1007.  y1 = o_OsziFrameYPos+o_OsziHeight;
  1008.  y2 = y1 + 5;
  1009.  y3 = y1 + 2;
  1010.  
  1011.  while(x1 <= o_OsziFrameXPos_AND_o_OsziFrameWidth) {
  1012.      XDrawLine(my_display,my_window,my_gc,x1,y1,x1,y2);
  1013.      sprintf(buf,"%d",(int)(count*o_XScaleValues[o_XCounter].Einheit));
  1014.      buflen = strlen(buf);
  1015.      XDrawString(o_display,o_window,o_gc,
  1016.                    x1-(XTextWidth(o_fontStruct,buf,buflen)>>1)+1,y2+FontWriteXPos,buf,buflen);  
  1017.   x1 += o_XScaleValues[o_XCounter].ScreenEinheit;
  1018.   count++;
  1019.  }
  1020. }
  1021.  
  1022.  
  1023.